From 7f0d1e91d387f93424120c263e56b85047acb06d Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Wed, 23 Aug 2017 19:34:00 +0200 Subject: [PATCH] xen/common/efi/boot.c: let custom parameter parsing routines return errno Modify the custom parameter parsing routines in: xen/common/efi/boot.c to indicate whether the parameter value was parsed successfully. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- xen/common/efi/boot.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 11bdc7a2a4..01d33004e0 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1306,9 +1306,10 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) static bool __initdata efi_map_uc; -static void __init parse_efi_param(char *s) +static int __init parse_efi_param(const char *s) { - char *ss; + const char *ss; + int rc = 0; do { bool val = strncmp(s, "no-", 3); @@ -1317,21 +1318,25 @@ static void __init parse_efi_param(char *s) s += 3; ss = strchr(s, ','); - if ( ss ) - *ss = '\0'; + if ( !ss ) + ss = strchr(s, '\0'); - if ( !strcmp(s, "rs") ) + if ( !strncmp(s, "rs", ss - s) ) { if ( val ) __set_bit(EFI_RS, &efi_flags); else __clear_bit(EFI_RS, &efi_flags); } - else if ( !strcmp(s, "attr=uc") ) + else if ( !strncmp(s, "attr=uc", ss - s) ) efi_map_uc = val; + else + rc = -EINVAL; s = ss + 1; - } while ( ss ); + } while ( *ss ); + + return rc; } custom_param("efi", parse_efi_param); -- 2.30.2